<template>
  <van-grid :column-num="5" :border="false">
    <van-grid-item
      @click="goToCategory(index)"
      v-for="(item, index) in navBarList"
      :key="item.name"
      :text="item.name"
      :icon="item.icon_url"
    />
  </van-grid>
</template>

<script>
export default {
  name: 'NavBar',
  props: {
    navBarList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    goToCategory (index) {
      this.$router.push({ name: 'Category', params: { currentIndex: index } })
    }
  }
}

</script>
<style lang='scss' scoped>

</style>
